package com.gdcn.zb.sys.service.impl;

import java.util.List;
import com.gdcn.zb.base.BaseService;
import com.gdcn.zb.base.exception.DaoException;
import com.gdcn.zb.base.exception.ServiceException;
import com.gdcn.zb.sys.dao.IFundTypeDao;
import com.gdcn.zb.sys.service.IFundTypeService;
import com.gdcn.zb.sys.valueobject.FundType;


public class FundTypeServiceImpl extends BaseService implements IFundTypeService {
	private IFundTypeDao fundTypeDao ;
	
	public void setFundTypeDao(IFundTypeDao fundTypeDao) {
		this.fundTypeDao = fundTypeDao;
	}
	
	public void createFundType(FundType fundType) throws ServiceException {
		try{
			fundTypeDao.createFundType(fundType);
		}catch (DaoException e) {
			logger.error(e);
			throw new ServiceException(e);
		}
	}

	public void deleteFundType(String id) throws ServiceException {
		try{
			fundTypeDao.deleteFundType(id);
		}catch (DaoException e) {
			logger.error(e);
			throw new ServiceException(e);
		}
		
	}

	public FundType findFundTypeById(String id) throws ServiceException {
		FundType fundType = null;
		try{
				fundType = fundTypeDao.findFundTypeById(id);
		}catch (DaoException e) {
			logger.error(e);
			throw new ServiceException(e);
		}
		return fundType;
	}

	public void updateFundType(FundType fundType) {
		try{
			fundTypeDao.updateFundType(fundType);
		}catch (DaoException e) {
			logger.error(e);
			throw new ServiceException(e);
		}		
	}
	public List listFundTypeOfAll() throws ServiceException {
		List list = null;
		try{
			list = fundTypeDao.listFundTypeOfAll();
		}catch (DaoException e) {
			logger.error(e);
			throw new ServiceException(e);
		}
		return list;
	}
	
	public void deleteFundType(String[] id) throws ServiceException {
		if(id != null){
			for(int i=0;i<id.length;i++){
				deleteFundType(id[i]);
			}
		}
		
	}


}
